WavySlider

fun WavySlider(value: Float, onValueChange: (Float) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, valueRange: ClosedFloatingPointRange<Float> = 0f..1f, onValueChangeFinished: () -> Unit? = null, interactionSource: MutableInteractionSource? = null, colors: SliderColors = SliderDefaults.colors(), waveLength: Dp = SliderDefaults.WaveLength, waveHeight: Dp = SliderDefaults.WaveHeight, waveVelocity: WaveVelocity = SliderDefaults.WaveVelocity, waveThickness: Dp = SliderDefaults.WaveThickness, trackThickness: Dp = SliderDefaults.TrackThickness, incremental: Boolean = SliderDefaults.Incremental, animationSpecs: WaveAnimationSpecs = SliderDefaults.WaveAnimationSpecs)(source)

A wavy slider much like the Material Design 2 Slider.

Setting waveHeight or waveLength to 0.dp results in a regular Slider.

Note that range sliders do not make sense for the WavySlider. So, there is no RangeWavySlider counterpart.

Parameters

value

current value of the WavySlider. Will be coerced to valueRange.

onValueChange

lambda in which value should be updated.

modifier

modifiers for the WavySlider layout.

enabled

whether or not component is enabled and can be interacted with or not.

valueRange

range of values that WavySlider value can take. Passed value will be coerced to this range.

onValueChangeFinished

lambda to be invoked when value change has ended. This callback shouldn't be used to update the WavySlider value (use onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click.

interactionSource

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this WavySlider. You can use this to change the WavySlider's appearance or preview the WavySlider in different states. Note that if null is provided, interactions will still happen internally.

colors

SliderColors that will be used to determine the color of the WavySlider parts in different state. See SliderDefaults.colors to customize.

waveLength

the distance over which the wave's shape repeats.

waveHeight

the total height of the wave (from crest to trough i.e. amplitude * 2). The final rendered height of the wave will be waveHeight + waveThickness.

waveVelocity

the horizontal movement (speed per second and direction) of the whole wave (aka phase shift). Setting speed to 0.dp or less stops the movement.

waveThickness

the thickness of the active line (whether animated or not).

trackThickness

the thickness of the inactive line.

incremental

whether to gradually increase height from zero at start to waveHeight at thumb.

animationSpecs

animation configurations used for various properties of the wave.